<template>
  <div class="mod-config">
    <h2 style="text-align: center;">添加球员</h2>

    <el-steps :active="3" process-status="wait" align-center style="margin-bottom: 40px;">
      <el-step title="球员信息"/>
      <el-step title="球员常规赛基础数据"/>
      <el-step title="球员常规赛进阶数据"/>
    </el-steps>

    <el-form  :model="list" label-width="100px"
    width="100" :inline="true" class="demo-form-inline" style="margin-left:10%">
  <el-form-item label="进攻效率" >
    <el-input v-model="list.attackEfficiency" ></el-input>
  </el-form-item>
  <el-form-item label="防守效率">
    <el-input v-model="list.defenseEfficiency"></el-input>
  </el-form-item>
  <el-form-item label="真实投篮命中率">
    <el-input v-model="list.trueShot"></el-input>
  </el-form-item>
   <el-form-item label="球员使用率">
    <el-input v-model="list.utilization"></el-input>
  </el-form-item>
  <el-form-item label="球员效率值">
    <el-input v-model="list.per"></el-input>
  </el-form-item>
  <el-form-item label="赛季">
    <el-input v-model="list.season"></el-input>
  </el-form-item>
  <el-form-item label="常规赛/季后赛/总决赛">
     <el-input v-model="list.stage"></el-input>
  </el-form-item>
    <br>
  <el-form-item  style="margin-left:30%">
            <el-button @click="previous">上一步</el-button>
            <el-button type="primary" @click="addadvanced">保存</el-button>
  </el-form-item>
</el-form>
 </div>
</template>
<script>
export default {
    data() {
      return {
          list:{
          id: '',
          playerId: '',
          attackEfficiency: '',
          defenseEfficiency: '',
          trueShot: '',
          utilization: '',
          per: '',
          season: '',
          stage: ''
          }
      }
    },
    created(){
        if(this.$route.params && this.$route.params.id) {
           this.list.playerId=this.$route.params.id
           this.getadvancedById()
        }
        
    },
    methods: {
        addadvanced(){
          this.$http({
          url: this.$http.adornUrl('/player/playeradvanced/save'),
          method: 'post',
          data:this.list
        }).then(({data}) => {
               this.$message({
                    type:'success',
                    message:'添加球员进阶数据成功！'
                });
              this.$router.push({ path: '/player-playerinformation' })
        })
        },
        previous() {
            this.$router.push({
                 path:'/player/player-update-basicdate/'+this.$route.params.id
               });
        },
         getadvancedById(){
          this.$http({
          url: this.$http.adornUrl(`/player/playeradvanced/infoByPlayerId/${this.$route.params.id}`),
          method: 'post'
        }).then(({data}) => {
             if( data.playerAdvanced!=null){
               this.list = data.playerAdvanced
              }
            
        })
    }
    }
  }
</script>
<style>

</style>